/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.IOException;
import java.util.LinkedList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Lid;

/**
 *
 * @author Sujen
 */
public class GebruikerVerwijderController extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        int lidId = Integer.parseInt(request.getParameter("id"));

        HttpSession sessie = request.getSession();
        LinkedList<Lid> list = (LinkedList) sessie.getAttribute("currentUser");

        for (Lid lid2 : list) {
            if (lid2.getLidId() == lidId) {
                list.remove(lid2);
                break;
            }
        }
        
        sessie.setAttribute("currentUser", list);
        response.sendRedirect("/mijnDryves.jsp");

    }
}
